<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!--banner-->
<!-- 登录 -->
<input type="hidden" id="contextPath" value="<%=request.getContextPath() %>">
<c:set value="<%=request.getContextPath() %>" var="contextPath" scope="session"/>
<div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <ul id="myTabLogin" class="nav nav-tabs">
                    <li class="active">
                        <a href="#hr" data-toggle="tab">我是企业HR</a>
                    </li>
                    <li><a href="#Applicant" data-toggle="tab">我是求职者</a></li>
                </ul>
            </div>
            <div class="modal-body">
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade in active" id="hr">
                        <form action="<c:url value="/login_company_user"/>" method="post" id="loginCompanyUserForm">
                            <div class="form-group">
                                <input type="text" class="form-control" name="loginName" placeholder="用户名">
                            </div>
                            <div class="form-group">
                                <input type="password" class="form-control" name="password"
                                       placeholder="密码(6-15字母、数字、无空格)"
                                       validate-title="密码"
                                       data-valid="false">
                            </div>
                            <div class="form-group">
                                <input id="loginCompanyBtn" type="submit" value="HR登录"
                                       class="btn btn-warning col-md-12">
                            </div>
                            <div class="form-group cymgtop80">
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox"> 下次自动登录
                                    </label>
                                    <a class="float_left" href="/passport/forgetPwd/" target="_blank"
                                       class="float-right">忘记密码？</a>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="tab-pane fade" id="Applicant">
                        <form action="<c:url value="/person/login"/>" method="post" id="loginUserForm">
                            <div class="form-group">
                                <input type="text" class="form-control" name="loginName" placeholder="邮箱/手机号">
                            </div>
                            <div class="form-group">
                                <input type="password" class="form-control" name="password"
                                       placeholder="密码(6-15字母、数字、无空格)"
                                       validate-title="密码" data-valid="false">
                            </div>
                            <div class="form-group">
                                <input type="submit" value="求职者登录" class="btn btn-warning col-md-12">
                            </div>
                            <div class="form-group cymgtop80">
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox"> 下次自动登录
                                    </label>
                                    <a class="float_left" href="/passport/forgetPwd/" target="_blank"
                                       class="float-right">忘记密码？</a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 注册 -->
<div class="modal fade" id="registerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <ul id="myTabRegister" class="nav nav-tabs">
                    <li class="active">
                        <a href="#hr2" data-toggle="tab">我是企业HR</a>
                    </li>
                    <li><a href="#Applicant2" data-toggle="tab">我是求职者</a></li>
                </ul>
            </div>
            <div class="modal-body">
                <div id="myTabContent2" class="tab-content">
                    <div class="tab-pane fade in active" id="hr2">
                        <form action="<c:url value="/create_company_user"/>" method="post" id="registerCompanyUserForm">
                            <div class="form-group">
                                <input type="text" class="form-control" name="loginName" placeholder="用户名">
                            </div>
                            <div class="form-group">
                                <input type="password" class="form-control" name="password"
                                       placeholder="密码(6-15字母、数字、无空格)" validate-title="密码"
                                       data-valid="false">
                            </div>
                            <div class="form-group">
                                <input type="text" class="form-control" name="email" placeholder="邮箱">
                            </div>
                            <div class="form-group">
                                <input type="text" name="randomCode" value="" placeholder="验证码"
                                       class="col-md-4 form-control"
                                       validate-title="验证码" style="width: 40%">
                                <img src="${contextPath}/randomCode" id="companyUserImgRandom" alt="验证码,看不清楚?请点击刷新验证码"
                                     style="margin: 1px 10px 0px">
                                <a href="javascript:;" id="companyUserRandom">换一张</a>
                            </div>
                            <div class="form-group">
                                <input id="registerCompanyBtn" type="submit" value="免费注册"
                                       class="btn btn-warning form-control col-md-12">
                            </div>
                            <br><br>
                        </form>
                    </div>
                    <div class="tab-pane fade" id="Applicant2">
                        <form action="<c:url value="/person/create_user"/>" method="post" class=""
                              id="registerUserForm">
                            <div class="form-group">
                                <input type="text" class="form-control" name="loginName" placeholder="用户名">
                            </div>
                            <div class="form-group">
                                <input type="password" class="form-control" name="password"
                                       placeholder="密码(6-15字母、数字、无空格)" validate-title="密码"
                                       data-valid="false">
                            </div>
                            <div class="form-group">
                                <input type="text" name="randomCode" value="" placeholder="验证码"
                                       class="col-md-4 form-control"
                                       validate-title="验证码" style="width: 40%">
                                <img src="${contextPath}/randomCode" id="userImgRandom" alt="验证码,看不清楚?请点击刷新验证码"
                                     style="margin: 1px 10px 0px">
                                <a href="javascript:;" id="userRandom">换一张</a>
                            </div>
                            <div class="form-group">
                                <input type="submit" id="registerUserBtn" value="免费注册"
                                       class="btn btn-warning col-md-12">
                            </div>
                            <br><br>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--banner-->
<div id="carousel-example-generic" class="carousel slide cymgtop50" data-ride="carousel">
    <!-- Indicators -->
    <ol class="carousel-indicators cybt">
        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
        <li data-target="#carousel-example-generic" data-slide-to="3"></li>
        <li data-target="#carousel-example-generic" data-slide-to="4"></li>
        <li data-target="#carousel-example-generic" data-slide-to="5"></li>
    </ol>
    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">
        <div class="item active">
            <img src="${contextPath}/images/icon/1.jpg" alt="">
        </div>
        <div class="item">
            <img src="${contextPath}/images/icon/2.jpg" alt="">
        </div>
        <div class="item">
            <img src="${contextPath}/images/icon/3.jpg" alt="">
        </div>
        <div class="item">
            <img src="${contextPath}/images/icon/4.jpg" alt="">
        </div>
        <div class="item">
            <img src="${contextPath}/images/icon/5.jpg" alt="">
        </div>
        <div class="item">
            <img src="${contextPath}/images/icon/6.jpg" alt="">
        </div>
    </div>

    <!-- Controls -->
    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    </a>
    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    </a>
</div>
<!--搜索-->
<div class="container cymgtop20">
    <div class="row">
        <form class="form col-md-7 col-md-offset-1" role="search">
            <div class="form-group col-md-10">
                <input type="text" class="form-control border_radiu_rightno height48" placeholder="输入职位关键词：如 销售总监等">
            </div>
            <button type="button" id="searchBtn"
                    class="btn btn-primary col-md-2 border_radiu_leftno font_size22 cymgleft-15 height48">搜 索
            </button>
        </form>
        <p class="new-post col-md-3 ">
            本周新增职位&nbsp;&nbsp;<span>1</span><span>1</span><span>5</span><span>5</span><span>5</span>&nbsp;&nbsp;个</p>
    </div>
</div>

<div class="container projects">

    <div class="projects-header page-header">
        <h2>名企职位</h2>

        <p>下边是为你精心推荐的名企职位</p>
    </div>

    <div class="row">
        <% for (int i = 0; i < 16; i++) { %>
        <div class="col-sm-6 col-md-4 col-lg-3 ">
            <div class="thumbnail" style="height: 334px;">
                <a href="#" title="baidu" target="_blank">
                    <img src="${contextPath}/images/icon/google.png" width="300" height="150" alt="百度">
                </a>

                <div class="caption">
                    <h3>
                        <a href="#" title="baidu" target="_blank">
                            google
                            <br>
                            <small>by@google</small>
                        </a>
                    </h3>
                    <p>全球最大的中文搜索引擎、致力于让网民更便捷地获取信息！ </p>
                </div>
            </div>
        </div>
        <% } %>
    </div>
</div>

<script>
$(function () {
    $("#searchBtn").click(function (e) {
        var positionName = $("#textfield").val();
        location.href = "person/search.do?positionName=" + $("#positionName").val();
    });

    //企业用户注册绘制验证码
    $("#companyUserRandom").click(function () {
        var contextPath = $("#contextPath").val();
        $("#companyUserImgRandom").attr("src", contextPath + "/randomCode?" + Math.random());
    });

    //企业用户注册绘制验证码
    $("#userRandom").click(function () {
        var contextPath = $("#contextPath").val();
        $("#userImgRandom").attr("src", contextPath + "/randomCode?" + Math.random());
    });

    //用户登录表单验证
    $('#loginUserForm').bootstrapValidator({
        live: EJOB_APP.constants.live,
        feedbackIcons: EJOB_APP.constants.feedbackIcons,
        fields: {
            loginName: {
                message: '用户名无效',
                validators: {
                    notEmpty: {
                        message: '用户名不能为空'
                    },
                    remote: {
                        type: 'GET',
                        url: 'person/checkLoginUserExist',
                        message: '用户名不存在'
                    }
                }
            },
            password: {
                validators: {
                    notEmpty: {
                        message: '密码不能为空'
                    },
                    remote: {
                        url: 'person/checkLoginUserPasswordValid',
                        data: function (validator) {
                            return {
                                'loginName': validator.getFieldElements('loginName').val(),
                                'password': validator.getFieldElements('password').val()
                            };
                        },
                        message: '密码错误'
                    }
                }
            }
        }
    });

    //用户注册
    $('#registerUserForm').bootstrapValidator({
        live: EJOB_APP.constants.live,
        feedbackIcons: EJOB_APP.constants.feedbackIcons,
        fields: {
            loginName: {
                message: '用户名无效',
                validators: {
                    notEmpty: {
                        message: '用户名不能为空'
                    },
                    stringLength: {
                        min: 6,
                        max: 30,
                        message: '用户名长度要大于6小于30'
                    },
                    regexp: {
                        regexp: EJOB_APP.constants.loginNameRegexp,
                        message: '用户名只能包含字母、数字、点和下划线'
                    },
                    remote: {
                        type: 'GET',
                        url: 'person/checkUserExist',
                        message: '用户名已经存在'
                    }
                }
            },
            password: {
                validators: {
                    stringLength: {
                        min: 6,
                        max: 15,
                        message: '密码长度要大于6小于15'
                    },
                    regexp: {
                        regexp: EJOB_APP.constants.passwordRegexp,
                        message: '密码只能包含字母、数字'
                    },
                    notEmpty: {
                        message: '密码不能为空'
                    }
                }
            },
            randomCode: {
                validators: {
                    notEmpty: {
                        message: '验证码不能为空'
                    },
                    remote: {
                        type: 'GET',
                        url: 'checkRandomCode',
                        message: '验证码错误'
                    }
                }
            }
        }
    });

    //企业用户登录表单验证
    $('#loginCompanyUserForm').bootstrapValidator({
        live: EJOB_APP.constants.live,
        feedbackIcons: EJOB_APP.constants.feedbackIcons,
        fields: {
            loginName: {
                message: '用户名无效',
                validators: {
                    notEmpty: {
                        message: '用户名不能为空'
                    },
                    remote: {
                        type: 'GET',
                        url: 'checkLoginCompanyUserExist',
                        message: '用户名不存在'
                    }
                }
            },
            password: {
                validators: {
                    notEmpty: {
                        message: '密码不能为空'
                    },
                    remote: {
                        url: 'checkLoginCompanyUserPasswordValid',
                        data: function (validator) {
                            return {
                                'loginName': validator.getFieldElements('loginName').val(),
                                'password': validator.getFieldElements('password').val()
                            };
                        },
                        message: '密码错误'
                    }
                }
            }
        }
    });

    //企业用户注册表单验证
    $('#registerCompanyUserForm').bootstrapValidator({
        live: EJOB_APP.constants.live,
        feedbackIcons: EJOB_APP.constants.feedbackIcons,
        fields: {
            loginName: {
                message: '用户名无效',
                validators: {
                    notEmpty: {
                        message: '用户名不能为空'
                    },
                    stringLength: {
                        min: 6,
                        max: 30,
                        message: '用户名长度要大于6小于30'
                    },
                    regexp: {
                        regexp: EJOB_APP.constants.loginNameRegexp,
                        message: '用户名只能包含字母、数字、点和下划线'
                    },
                    remote: {
                        type: 'GET',
                        url: 'checkCompanyUserExist',
                        message: '用户名已经存在'
                    }
                }
            },
            email: {
                validators: {
                    notEmpty: {
                        message: '邮箱不能为空'
                    },
                    emailAddress: {
                        message: '不是有效邮箱'
                    }
                }
            },
            password: {
                validators: {
                    stringLength: {
                        min: 6,
                        max: 15,
                        message: '密码长度要大于6小于15'
                    },
                    regexp: {
                        regexp: EJOB_APP.constants.passwordRegexp,
                        message: '密码只能包含字母、数字'
                    },
                    notEmpty: {
                        message: '密码不能为空'
                    }
                }
            },
            randomCode: {
                validators: {
                    notEmpty: {
                        message: '验证码不能为空'
                    },
                    remote: {
                        type: 'GET',
                        url: 'checkRandomCode',
                        message: '验证码错误'
                    }
                }
            }
        }
    });
});
</script>

</body>
</html>